home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-06-16 | 2.3 KB | 70 lines | [TEXT/ToyS] |
- -- This script is postcard-ware (or email-ware, if you're so inclined...)
- -- Feel free to improve on it as you see fit. Send me a copy if you do!
- -- If you like it, please send me a postcard of your hometown!
- -- Philippe Casgrain
- -- 4 980 Boul. Lalande
- -- Pierrefonds, Qc.
- -- CANADA H8Y 1V8
-
- property filesToSend : {}
- property subjectsToMatch : {}
-
- if length of filesToSend is 0 then
- set doneAddingFiles to false
- set oneSubject to ""
-
- repeat until doneAddingFiles
- set oneFile to choose file with prompt ¬
- "Select a file you wish to auto-send please..."
- set theQuestion to (display dialog ¬
- "What substring should the 'Subject:' match with this file?" ¬
- buttons {"Cancel", "OK and Done", "OK and Add more..."} ¬
- default answer oneSubject ¬
- default button "OK and Add more...")
-
- set oneSubject to (text returned of theQuestion)
-
- set filesToSend to filesToSend & oneFile
- set subjectsToMatch to subjectsToMatch & oneSubject
-
- set doneAddingFiles to (button returned of theQuestion is "Ok and Done")
- end repeat
- end if
-
- tell application "Eudora1.4.2"
- set numberOfMessages to count message in mailbox "In" of mail folder ""
- set curMsg to 1
- set trashMsg to count message in mailbox "Trash" of mail folder ""
- repeat numberOfMessages times
- set doneParsingMessage to false
- set didTrashMessage to false
- set curSubject to 1
- repeat until doneParsingMessage
- if field "Subject:" of message curMsg of mailbox "In" of mail folder "" ¬
- contains (item curSubject of subjectsToMatch) then
- move (message curMsg of mailbox "In" of mail folder "") ¬
- inserthere end of mailbox "Trash" of mail folder ""
- set trashMsg to trashMsg + 1
- set theReply to reply (message trashMsg of mailbox "Trash" ¬
- of mail folder "")
- attach theReply documentlist (item curSubject of filesToSend)
- queue theReply queuetype 1
- set didTrashMessage to true
- else
- set curSubject to curSubject + 1
- end if
- set doneParsingMessage to ((curSubject > (count of subjectsToMatch)) or didTrashMessage)
- end repeat
- if not didTrashMessage then
- set curMsg to curMsg + 1
- end if
- end repeat
-
- -- Send the queued messages, if any
- if (count message in mailbox "Out" of mail folder "") > 0 then
- with timeout of 36000 seconds -- 10 hour ought to do it...
- connect with send without check
- end timeout
- end if
-
- end tell